package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.entity.dto.ReplyDTO;
import com.tianji.learning.entity.query.ReplyPageQuery;
import com.tianji.learning.entity.vo.ReplyVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 互动问题的回答或评论 控制器
 * </p>
 *
 * @author lemon
 */
@Api(tags = "互动回答或评论相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/replies")
public class InteractionReplyController {

    private final IInteractionReplyService interactionReplyService;

    @ApiOperation("新增互动回答或评论")
    @PostMapping
    public void addInteractionReply(@RequestBody @Validated ReplyDTO dto) {
        interactionReplyService.addInteractionReply(dto);
    }

    @ApiOperation("分页查询互动回答或评论-用户端")
    @GetMapping("page")
    public PageDTO<ReplyVO> queryReplyPageForUser(ReplyPageQuery query) {
        return interactionReplyService.queryReplyPage(query, false);
    }


}
